﻿using SWEN3Application.Classes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SWEN3Application
{
    public partial class AuthenticationforStaffManagement : Form
    {
        public AuthenticationforStaffManagement()
        {
            InitializeComponent();
        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            GeneralModuleDBManager gm = new GeneralModuleDBManager();
            UserAccount user = new UserAccount();
            user = gm.login(tbxAdminUser.Text, tbxPassword.Text);
            if (user != null)
            {
                if (user.UserType == 1 || user.UserType == 2)
                {
                    this.Hide();
                    StaffManagement st = new StaffManagement();
                    st.Show();
                    
                }
                else
                {
                    lblStatus.Text = "You have no authority to access";
                }
            }
            else
            {
                lblStatus.Text = "Wrong Username and Password";
            }
        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            MasterForm mf = new MasterForm();
            mf.Show();
            this.Hide();
        }
    }
}
